<template>
  <div class="app-container">
    <div class="filter-container">
      <template>
        <el-select v-model="value" clearable placeholder="请选择">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
        <el-button icon="el-icon-search"></el-button>

        <el-select v-model="value" class="choice-option" clearable placeholder="请选择看不清">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>

        <el-select v-model="value" class="choice-option" clearable placeholder="请选择看不清">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>

        <el-select v-model="value" class="choice-option" clearable placeholder="请选择看不清">
          <el-option
            v-for="item in options"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>

        <el-select v-model="value" class="choice-option" clearable placeholder="全部">
          <el-option
            v-for="item in [{
        value: '选项1',
        label: '全部'
      }]"
            :key="item.value"
            :label="item.label"
            :value="item.value"
          >
          </el-option>
        </el-select>
      </template>
    </div>
    <div style="margin-bottom: 10px">
      <el-button type="success" size="medium" @click="dialogFormVisible = true">添加</el-button>
      <el-button type="primary" size="medium" @click="dialogFormVisible = true">快速什么什么付商品</el-button>
      <el-button type="danger" size="medium" @click="dialogFormVisible = true">商品看不清</el-button>
      <el-button type="primary" size="medium" @click="dialogFormVisible = true">批量公开</el-button>
      <el-button type="primary" size="medium" @click="dialogFormVisible = true">批量不公开</el-button>
    </div>
    <div class="div-table">
      <el-table
        ref="multipleTable"
        :data="tableData"
        border
        stripe
        tooltip-effect="dark"
        @selection-change="handleSelectionChange"
      >
        <el-table-column type="selection" width="55" align="center">
        </el-table-column>

        <el-table-column label="看不清" align="center">
          <template v-slot="scope">
            <el-input v-model="scope.row.name" />
          </template>
        </el-table-column>

        <el-table-column prop="address" label="封面" align="center">
          <template v-slot="scope">
            <img src="@/image/nvm.png" alt="" style="height: 40px" />
          </template>
        </el-table-column>

        <el-table-column label="商品类目" align="center">
          <template v-slot="scope">
            <el-tag size="medium" type="warning">{{ scope.row.name }}</el-tag>
          </template>
        </el-table-column>

        <el-table-column label="商品名称" align="center" prop="address">
        </el-table-column>
        <el-table-column label="扣款模式" align="center" prop="date">
        </el-table-column>
        <el-table-column label="期数信息" align="center" prop="date">
        </el-table-column>
        <el-table-column label="扣费信息（周月）" align="center" prop="date">
        </el-table-column>
        <el-table-column label="扣款信息（次卡）" align="center" >
          <template >
            <span>无</span>
          </template>
        </el-table-column>
        <el-table-column label="库存信息" align="center" >
          <template >
            <span>公开</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center">
          <template v-slot="scope">
            <el-button type="warning" size="mini">不公开</el-button>
            <el-button type="primary" size="mini">编辑</el-button>
            <el-button type="danger" size="mini" @click="deleteRow(scope.row.$index)">删除</el-button>
          </template>
        </el-table-column>
      </el-table>
    </div>

    <div class="pagination">
      <el-pagination
        background
        layout="prev, pager, next"
        :total="1000"
        style="text-align: right"
      >
      </el-pagination>
    </div>

    <div class="dialog-add">
      <el-dialog title="添加表单" :visible.sync="dialogFormVisible">
        <el-form :model="form">
          <el-form-item label="名称" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="账号" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
          <el-form-item label="审核" :label-width="formLabelWidth">
            <el-input v-model="form.name" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="dialogFormVisible = false">确 定</el-button>
        </div>
      </el-dialog>
    </div>
  </div>
</template>

<script>

export default {

  filters: {
    statusFilter(status) {
      const statusMap = {
        published: 'success',
        draft: 'gray',
        deleted: 'danger'
      }
      return statusMap[status]
    }
  },
  data() {
    const options = [
      {
        value: '选项1',
        label: '黄金糕'
      },
      {
        value: '选项2',
        label: '双皮奶'
      },
      {
        value: '选项3',
        label: '蚵仔煎'
      },
      {
        value: '选项4',
        label: '龙须面'
      },
      {
        value: '选项5',
        label: '北京烤鸭'
      }
    ];
    const tableData = [{
      date: '2016-05-02',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1518 弄'
    }, {
      date: '2016-05-04',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1517 弄'
    }, {
      date: '2016-05-01',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1519 弄'
    }, {
      date: '2016-05-03',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1516 弄'
    }];
    return {
      list: null,
      listLoading: true,
      dialogTableVisible: false,
      dialogFormVisible: false,
      form: {
        name: '',
        region: '',
        date1: '',
        date2: '',
        delivery: false,
        type: [],
        resource: '',
        desc: ''
      },
      formLabelWidth: '120px',
      options,
      value: '',
      tableData
    }
  },
  methods: {
    deleteRow(index) {
      this.list.splice(index, 1)
    }
  }
}
</script>

<style>
.choice-option {
  width: 200px;
  margin-right: 50px;
}

.filter-container {
  margin-bottom: 20px;
}
</style>
